﻿/*
 * Created by SharpDevelop.
 * User: aleva3
 * Date: 11/7/2012
 * Time: 12:13
 * 
 * To change this template use Tools | Options | Coding | Edit Standard Headers.
 */
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Windows.Forms;

namespace Knot_to_meterpersecond
{
	/// <summary>
	/// Description of MainForm.
	/// </summary>
	public partial class MainForm : Form
	{
		public MainForm()
		{
			//
			// The InitializeComponent() call is required for Windows Forms designer support.
			//
			InitializeComponent();
			
			//
			// TODO: Add constructor code after the InitializeComponent() call.
			//
		}
		
		void Button1Click(object sender, EventArgs e)
		{
			double Kn, Kh, Ms;
			
			Kn=Convert.ToDouble(textBox1.Text);
			Kh=Convert.ToDouble(textBox2.Text);
			Ms=Convert.ToDouble(textBox3.Text);
			
			if (Kn!=0)
			{
				Kh=Kn*1.852;
				Ms=Kh/3.6;
			}
			else
			{
				if (Kh!=0)
				{
					Kn=Kh/1.852;
					Ms=Kh/3.6;
				}
				else
				{
					Kh=Ms*3.6;
					Kn=Kh/1.852;
				}
			}
			
			textBox1.Text=Convert.ToString(Kn);
			textBox2.Text=Convert.ToString(Kh);
			textBox3.Text=Convert.ToString(Ms);
		}
		
		void Button2Click(object sender, EventArgs e)
		{
			textBox1.Text=Convert.ToString(0);
			textBox2.Text=Convert.ToString(0);
			textBox3.Text=Convert.ToString(0);
		}
	}
}
